package com.heba.greenmulu.user;

import android.os.Bundle;
import android.widget.ImageView;

import com.heba.Cfg;
import com.heba.greenmulu.BaseActivity;
import com.heba.greenmulu.R;

/**
 * 设置-推送页面
 * <p>
 * Created by jason on 2019/2/12.
 */

public class UserNotificationActivity extends BaseActivity {

    private ImageView img_check1;
    private ImageView img_check2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_user_notification);
        initTopbar();
        findViewById();
        initView();
    }

    @Override
    protected void findViewById() {
        img_check1 = findViewById(R.id.img_check1);
        img_check2 = findViewById(R.id.img_check2);

        img_check1.setSelected(Cfg.isPushTime1 ? false : true);
        img_check2.setSelected(Cfg.isPushTime2 ? false : true);

        /**
         * 监听事件
         */
        img_check1.setOnClickListener(v -> {
            img_check1.setSelected(img_check1.isSelected() ? false : true);
            if (img_check1.isSelected()) {
                Cfg.save("isPushTime1", false);
            } else {
                Cfg.save("isPushTime1", true);
            }
        });

        /**
         * 监听事件
         */
        img_check2.setOnClickListener(v -> {
            img_check2.setSelected(img_check2.isSelected() ? false : true);
            if (img_check2.isSelected()) {
                Cfg.save("isPushTime2", false);
            } else {
                Cfg.save("isPushTime2", true);
            }
        });
    }

    @Override
    protected void initView() {
        txt_title.setText(getResources().getString(R.string.push_notification));
    }
}
